#include "frmfindpassword.h"
#include "ui_frmfindpassword.h"

frmFindPassword::frmFindPassword(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::frmFindPassword)
{
    ui->setupUi(this);
}

frmFindPassword::~frmFindPassword()
{
    delete ui;
}

void frmFindPassword::on_btnFind_clicked()
{
    string name = ui->letName->text().toStdString();
    for(int i = 0; i < UserList::userlist->size(); i++){
        User *u = UserList::userlist->at(i);
        if(name == u->name){
            //打印密码
            ui->tdtPassword->setText(QString::fromStdString(u->password));
            return;
        }
    }
    QMessageBox::critical(this, "错误", "未能找到该用户！");
}
